// 用户登陆
let loginUrl = 'user/login';
// 学校 数据（只有学校）
let schoolUrl = 'address/allSchool';
// 学校 楼栋 宿舍  三级联动 数据
let linkageInfoUrl = "address/linkageInfo";
// 用户支付二维码
let payCodeUrl = 'pay/scancodepay';
// 用户支付查询
let payQueryUrl = 'pay/queryOrder';

// 新增收货地址
let addAddressUrl = 'address/addAddress'

// 获取所有收货地址
let getAllAddressUrl = 'address/getAllAddress'
// 获取默认收货地址
let getDefaultAddressUrl = 'user/getDefaultAddress'
// 获取所有的快递价格list 通过学校
let getAllPriceUrl = 'order/allPrice'
// 获取所有的快递站点list 通过学校
let getKuaidiSchoolUrl = 'order/allKuaidi'
// 获取所有的订单list 
let getOrderListUrl = 'order/allOrder'


// 获取所有的公告banner信息 通过学校
let getAllBannerUrl = 'banner/getBannerBySchool'


// 微信支付测试
let wxPayUrl = 'wxPay/activePay'
// 微信订单查询
let wxOrderCheckUrl = 'wxPay/checkWxOrder'


//小程序配送   
let boxSendUrl = 'order/orderInfo'

//小程序包裹状态改变   
let changeOrderInfoStatusUrl = 'order/changeOrderInfoStatus'

//小程序根据包裹订单号获取包裹信息
let getBoxInfoByBoxOrderNumUrl = 'order/getBoxInfoByBoxOrderNum'
//获取用户信息
let getUserInfoUrl = 'user/getUserInfo'
//修改用户信息
let modifiyUserInfoUrl = 'user/modifiyUserInfo'
//订单详情
let orderDetailUrl = 'order/getOrderDetail'



const install = (Vue, vm) => {
  // 用户登陆
  let userLoginApi = (params) => vm.$u.post(loginUrl, params);
  // 获取大学list
  let getSchoolListApi = (params) => vm.$u.post(schoolUrl, params);
  // 获取支付二维码
  let getPayCodeApi = (params) => vm.$u.post(payCodeUrl, params);
  //  学校 楼栋 宿舍  三级联动 数据
  let getLinkageInfoApi = (params) => vm.$u.post(linkageInfoUrl, params);
  // 新增收货地址
  let addAddressApi = (params) => vm.$u.post(addAddressUrl, params);
  // 获取所有收货地址
  let getAllAddressApi = (params) => vm.$u.post(getAllAddressUrl, params);
  // 获取默认收货地址
  let getDefaultAddressUrlApi = (params) => vm.$u.post(getDefaultAddressUrl, params);
  // 获取所有的快递价格list
  let getAllPriceApi = (params) => vm.$u.post(getAllPriceUrl, params);
  // 获取所有的快递站点list  通过schoolId
  let getKuaidiBySchoolApi = (params) => vm.$u.post(getKuaidiSchoolUrl, params);
  // 获取所有的公告banner信息 通过学校
  let getAllBannerApi = (params) => vm.$u.post(getAllBannerUrl, params);
  // 获取所有的订单list 
  let getAllOrderListApi = (params) => vm.$u.post(getOrderListUrl, params);



  // 获取所有的公告banner信息 通过学校
  let payQueryApi = (params) => vm.$u.post(payQueryUrl, params);


  // 微信支付测试
  let wxPayApi = (params) => vm.$u.post(wxPayUrl, params);
  // 微信支付测试
  let wxOrderCheckApi = (params) => vm.$u.post(wxOrderCheckUrl, params);


  //小程序配送   
  let boxSendApi = (params) => vm.$u.post(boxSendUrl, params);
  //小程序包裹状态改变   
  let changeOrderInfoStatusApi = (params) => vm.$u.post(changeOrderInfoStatusUrl, params);
  //小程序根据包裹订单号获取包裹信息
  let getBoxInfoByBoxOrderNumApi = (params) => vm.$u.post(getBoxInfoByBoxOrderNumUrl, params);

  //获取用户信息
  let getUserInfoApi = (params) => vm.$u.post(getUserInfoUrl, params);
  //修改用户信息
  let modifiyUserInfoApi = (params) => vm.$u.post(modifiyUserInfoUrl, params);

  //订单详情
  let orderDetailApi = (params) => vm.$u.post(orderDetailUrl, params);


  // 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
  vm.$u.api = {
    userLoginApi,
    getSchoolListApi,
    getPayCodeApi,
    getLinkageInfoApi,
    addAddressApi,
    getAllAddressApi,
    getDefaultAddressUrlApi,
    getAllPriceApi,
    getKuaidiBySchoolApi,
    getAllBannerApi,
    payQueryApi,
    getAllOrderListApi,
    wxPayApi,
    wxOrderCheckApi,
    boxSendApi,
    changeOrderInfoStatusApi,
    getBoxInfoByBoxOrderNumApi,
    getUserInfoApi,
    modifiyUserInfoApi,
    orderDetailApi
  };
}

export default {
  install
}